﻿using System.Collections.Generic;
using Jayden.Dll.Core.Persistence.Models;

namespace Jayden.Dll.Core.Persistence.Xml
{
	public class XmlHelper
	{

		public static string XPath(Entity entity) { return entity.Table.TableName; }
		public static string XPath(Entity entity, params Property[] properties)
		{
			List<string> ps = new List<string>();
			for (int c = 0; c < properties.Length; c++)
				ps.Add(string.Format("{0}=\"{{{1}}}\"", properties[c].Field.FieldName, c));
			return XPath(entity) + "[@" + string.Join(" and ", ps) + "]";
		}
	}
}
